﻿// Copyright (c) 2012 - 2020 Jared Zheng <jaredz at outlook dot com>
// Buddha Framework is licensed under Mulan PSL v2.
// You can use this software according to the terms and conditions of the Mulan PSL v2.
// You may obtain a copy of Mulan PSL v2 at:
//          http://license.coscl.org.cn/MulanPSL2
// THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
// EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
// MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
// See the Mulan PSL v2 for more details.
//
// Create : 2012-12-01 version 0.1 Jared Zheng <jaredz at outlook dot com>
// Update : 2018-12-05 version 3.1.5 Jared Zheng <jaredz at outlook dot com>

#include "stdafx.h"
#include "commonpacket.h"

///////////////////////////////////////////////////////////////////////////////////////////////////////////
// CPAKHeadBase
CPAKHeadBase* CPAKHeadBase::Create(CStream& Stream)
{
    UEVENT uEvent = 0;
    CPAKHeadBase* pPak = CommonPack::Create(Stream, uEvent);
    if (pPak == nullptr)
    {
        if ((uEvent >= PAKE_AUTHOR_BEGIN) && (uEvent <= PAKE_AUTHOR_END))
        {
            pPak = MNEW CNETSession(uEvent);
        }
    }
    if (pPak != nullptr)
    {
        pPak->Serialize(Stream);
    }
    return pPak;
}
